<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>

  <style>
      h1 {
          text-align: center;
          font-size: 46px;
          font-weight: normal;
      }
      .box {
          position: absolute;
          left: 0;
          top: 0;
          z-index: 9;
          width: 100%;
          height: 100%;
          background-color: #333;
      }
      label {
          display: block;
          width: 100%;
          padding: 0 15px;
          box-sizing: border-box;
      }
      input {
          width: 100%;
          padding: 5px 0;
      }
  </style>
</head>
<body>

<div class="box">
  <h1 style="color: #fff">输入密码：</h1>
  <label>
    <input type="text">
    <button id="btn">进入</button>
  </label>
</div>
<script>
  if(!Number(localStorage.getItem('t'))) {
    const iptVal = document.querySelector('input');
    const btn = document.querySelector('#btn');
    btn.addEventListener('click', () => {
      if (iptVal.value === 'zilinhan') {
        window.localStorage.setItem('t', '1');
        window.location.href = './myHome.html?v=1.0';
      } else {
        alert('错误');
      }
    });
  }else {
    window.location.href = './myHome.html';
  }
</script>
</body>
</html>
